package com.zmc.third.application.factory;

import com.zmc.third.application.factory.service.PayService;
import com.zmc.third.application.factory.service.alipay.AbstractAlipayService;
import com.zmc.third.application.factory.service.alipay.AlipayService;
import com.zmc.third.application.factory.service.alipay.OrderPayPayServiceImpl;
import com.zmc.third.application.factory.service.alipay.WebsitePayServiceImpl;
import com.zmc.third.application.factory.service.wechat.WechatPayServiceImpl;
import com.zmc.third.infrastructure.enums.PayEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author：zmc
 * @Date：2024/11/9 10:09
 * 支付方式
 */

@Component
public class PayWayFactory {

    @Autowired
    private AbstractAlipayService abstractAlipayService;

    @Autowired
    private WechatPayServiceImpl wechatPayService;


    public PayService getPayWay(String payWay){
        //微信支付尚未开通
        if (PayEnum.PAY_WAY_WECHAT.getCode().equals(payWay)) {
            return wechatPayService;
        }
        return abstractAlipayService;
    }

    public PayService getRefundWay(String payWay){
        //微信支付尚未开通
        if (PayEnum.PAY_REFUND_WAY_WECHAT.getCode().equals(payWay)) {
            return wechatPayService;
        }
        return abstractAlipayService;
    }

    public PayService getNotifyWay(String payWay){
        //微信支付尚未开通
        if (PayEnum.PAY_NOTIFY_WAY_WECHAT.getCode().equals(payWay)) {
            return wechatPayService;
        }
        return abstractAlipayService;
    }



}
